Semantic-based memory encoding